#include "definition.h"
#include "basic.h"

void test(){
    Seqlist l;
    initList(l);
 

    /* 
    //强制打印
    for(int i=0;i<10;i++){
        cout << "第" << i+1 <<"个" <<endl;
        cout << "名字是:"<<l.data[i].name << endl;
        cout << "序号是:" <<l.data[i].number << endl;
    } */
    if(insertList(l,1,0,"Alice")){
        cout <<"insert success" <<endl;
    }
    //insertList(l,1,0,"Alice");
    insertList(l,2,1,"Baker");
    insertList(l,3,2,"Chris");

    printList(l);

    cout << "表长是 "<< lengthOfList(l) <<endl;

    string name;
    int number;
    if(deleteListByOrder(l,2,number,name)){
        cout <<"删除的学生序号是" <<number <<endl;
        cout <<"删除的学生名字是" <<name <<endl;
    }
    printList(l);

    deleteListByOrder(l,5,number,name);

    int n=2;
    string name2="";
    int number2;
    findElementByOrder(l,n,number2,name2);
    cout << "第" <<n <<"个位置的序号是" << number2 <<endl;
    cout << "第" <<n <<"个位置的名字是" << name2 <<endl;

    cout <<"Alice的位序是" <<findElementByValue(  l,"Alice") <<endl;

    if (isEmpty(l))
    {
        cout << "表空" <<endl;
    }
    else{
        cout << "表不空" <<endl;
    }

    Student a;
    a.number=0;
    a.name="Alice";
    if(findStructByValue(l,a)){
        cout <<"位序是" <<findStructByValue(l,a) <<endl;
    }
    




}


void test_dy(){
    Dynamiclist l;
    initDynamicList(l);
    cout <<l.data[9].number<<endl;
    //cout <<l.data[9].name<<endl;
    string a;
    cout <<a <<endl;
    


}

int main(){
   // test();

   test_dy();
    

}